import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class UncommonWordsFromTwoSentences {
    public String[] uncommonFromSentences(String s1, String s2) {
        List<String> list = new ArrayList<>();
        Map<String,Integer> maps = new HashMap<>();
        String[] arr_str1 = s1.split(" ");
        String[] arr_str2 = s2.split(" ");
        for (String str:arr_str1){
            if (maps.containsKey(str)){
                maps.put(str,2);
            }else {
                maps.put(str,1);
            }
        }
        for (String str:arr_str2){
            if (maps.containsKey(str)){
                maps.put(str,2);
            }else {
                maps.put(str,1);
            }
        }
        for (String key:maps.keySet()){
            if (maps.get(key)==1){
                list.add(key);
            }
        }
        String[] ans = new String[list.size()];
        for (int i=0;i<list.size();i++){
            ans[i] = list.get(i);
        }
        return ans;
    }

}
